﻿using Little.Soldier.SWIFT;
using Little.Soldier.SWIFT.Definition;
using System.Collections.Generic;
using System.ComponentModel;

namespace Little.Soldier.SWIFT.Messages.Category6
{
  public class MT609 : SwiftMessage
  {
    private static SwiftMessageDefinition MessageDefinition;
    private static SwiftTagDefinition U0002;
    private static SwiftTagSubItemDefinition U0003;
    private static SwiftTagSubItemDefinition U0004;
    private static SwiftTagDefinition U0005;
    private static SwiftTagSubItemDefinition U0006;
    private static SwiftTagDefinition U0007;
    private static SwiftTagSubItemDefinition U0008;
    private static SwiftTagDefinition U000E;
    private static SwiftTagSubItemDefinition U000F;
    private static SwiftTagSequenceDefinition U0010;
    private static SwiftTagDefinition U0011;
    private static SwiftTagSubItemDefinition U0012;
    private static SwiftTagSequenceDefinition U0013;
    private static SwiftTagDefinition U0014;
    private static SwiftTagSubItemDefinition U0015;
    private static SwiftTagChoiceDefinition U0016;
    private static SwiftTagDefinition U0017;
    private static SwiftTagSubItemDefinition U0018;
    private static SwiftTagSubItemDefinition U0019;
    private static SwiftTagSubItemDefinition U001A;
    private static SwiftTagSubItemDefinition U001B;
    private static SwiftTagSubItemDefinition U001C;
    private static SwiftTagSubItemDefinition U001D;
    private static SwiftTagSubItemDefinition U001E;
    private static SwiftTagSubItemDefinition U001F;
    private static SwiftTagSubItemDefinition U007F;
    private static SwiftTagSubItemDefinition U0080;
    private static SwiftTagSubItemDefinition U0081;
    private static SwiftTagSubItemDefinition U0082;
    private static SwiftTagSubItemDefinition U0083;
    private static SwiftTagSubItemDefinition U0084;
    private static SwiftTagSubItemDefinition U0086;
    private static SwiftTagSubItemDefinition U0087;
    private static SwiftTagSubItemDefinition U0088;
    private static SwiftTagSubItemDefinition U0089;
    private static SwiftTagSubItemDefinition U008A;
    private static SwiftTagDefinition U008B;
    private static SwiftTagSubItemDefinition U008C;
    private static SwiftTagSubItemDefinition U008D;
    private static SwiftTagSubItemDefinition U008E;
    private static SwiftTagSubItemDefinition U008F;
    private static SwiftTagSubItemDefinition U0090;
    private static SwiftTagSubItemDefinition U0091;
    private static SwiftTagSubItemDefinition U0092;
    private static SwiftTagSubItemDefinition U0093;
    private static SwiftTagSubItemDefinition U0094;
    private static SwiftTagSubItemDefinition U0095;
    private static SwiftTagDefinition U0096;

    [Description("Sequence of Total")]
    public Tag27 SequenceOfTotal_27
    {
      get
      {
        return new Tag27((SwiftElement) this, 0, (SwiftDefinitionElement) MT609.U0002);
      }
    }

    [Description("Sequence of Total")]
    public Tag27 Tag27_SequenceOfTotal
    {
      get
      {
        return this.SequenceOfTotal_27;
      }
    }

    [Description("Transaction Reference Number")]
    public Tag20 TransactionReferenceNumber_20
    {
      get
      {
        return new Tag20((SwiftElement) this, 0, (SwiftDefinitionElement) MT609.U0005);
      }
    }

    [Description("Transaction Reference Number")]
    public Tag20 Tag20_TransactionReferenceNumber
    {
      get
      {
        return this.TransactionReferenceNumber_20;
      }
    }

    [Description("Statement Date")]
    public Tag31C StatementDate_31C
    {
      get
      {
        return new Tag31C((SwiftElement) this, 0, (SwiftDefinitionElement) MT609.U0007);
      }
    }

    [Description("Statement Date")]
    public Tag31C Tag31C_StatementDate
    {
      get
      {
        return this.StatementDate_31C;
      }
    }

    [Description("Date Prepared")]
    public Tag30 DatePrepared_30
    {
      get
      {
        return new Tag30((SwiftElement) this, 0, (SwiftDefinitionElement) MT609.U000E);
      }
    }

    [Description("Date Prepared")]
    public Tag30 Tag30_DatePrepared
    {
      get
      {
        return this.DatePrepared_30;
      }
    }

    [Description("Sequence for BlockforNetworkRuleC85 and C86")]
    public MT609.BlockForNetworkRuleC85AndC86Class[] BlockForNetworkRuleC85AndC86
    {
      get
      {
        int index = -1;
        List<MT609.BlockForNetworkRuleC85AndC86Class> list = new List<MT609.BlockForNetworkRuleC85AndC86Class>();
        int count;
        do
        {
          ++index;
          MT609.BlockForNetworkRuleC85AndC86Class ruleC85AndC86Class = new MT609.BlockForNetworkRuleC85AndC86Class((SwiftElement) this, index, false);
          count = this.ListTags((SwiftElement) ruleC85AndC86Class).Count;
          if (count > 0)
            list.Add(ruleC85AndC86Class);
        }
        while (count > 0);
        return list.ToArray();
      }
    }

    public MT609()
      : base(true)
    {
    }

    public MT609(SwiftMessage message)
      : base(message)
    {
    }

    public MT609.BlockForNetworkRuleC85AndC86Class AddBlockForNetworkRuleC85AndC86()
    {
      return new MT609.BlockForNetworkRuleC85AndC86Class((SwiftElement) this, this.BlockForNetworkRuleC85AndC86.Length, true);
    }

    public void RemoveBlockForNetworkRuleC85AndC86(MT609.BlockForNetworkRuleC85AndC86Class sequence)
    {
      foreach (SwiftTag tag in this.ListTags((SwiftElement) sequence))
        this.RemoveTag(tag);
    }

    internal override SwiftMessageDefinition MsgDefinition()
    {
      return MT609.MessageDefinition;
    }

    protected override void InitSwiftMessageDefinition()
    {
      MT609.MessageDefinition = new SwiftMessageDefinition("MT609", "Statement of Commodity Contracts");
      MT609.U0002 = new SwiftTagDefinition("SequenceOfTotal_27", "Sequence of Total");
      MT609.U0002.TagName = ":27:";
      MT609.U0003 = new SwiftTagSubItemDefinition("Number", "Number");
      MT609.U0002.Elements.Add((SwiftDefinitionElement) MT609.U0003);
      MT609.U0004 = new SwiftTagSubItemDefinition("Total", "Total");
      MT609.U0002.Elements.Add((SwiftDefinitionElement) MT609.U0004);
      MT609.MessageDefinition.Elements.Add((SwiftDefinitionElement) MT609.U0002);
      MT609.U0005 = new SwiftTagDefinition("TransactionReferenceNumber_20", "Transaction Reference Number");
      MT609.U0005.TagName = ":20:";
      MT609.U0006 = new SwiftTagSubItemDefinition("Reference", "Reference");
      MT609.U0005.Elements.Add((SwiftDefinitionElement) MT609.U0006);
      MT609.MessageDefinition.Elements.Add((SwiftDefinitionElement) MT609.U0005);
      MT609.U0007 = new SwiftTagDefinition("StatementDate_31C", "Statement Date");
      MT609.U0007.TagName = ":31C:";
      MT609.U0008 = new SwiftTagSubItemDefinition("Date", "Date");
      MT609.U0007.Elements.Add((SwiftDefinitionElement) MT609.U0008);
      MT609.MessageDefinition.Elements.Add((SwiftDefinitionElement) MT609.U0007);
      MT609.U000E = new SwiftTagDefinition("DatePrepared_30", "Date Prepared");
      MT609.U000E.TagName = ":30:";
      MT609.U000E.Mandatory = false;
      MT609.U000F = new SwiftTagSubItemDefinition("Date", "Date");
      MT609.U000E.Elements.Add((SwiftDefinitionElement) MT609.U000F);
      MT609.MessageDefinition.Elements.Add((SwiftDefinitionElement) MT609.U000E);
      MT609.U0010 = new SwiftTagSequenceDefinition("BlockForNetworkRuleC85AndC86", "Sequence for BlockforNetworkRuleC85 and C86");
      MT609.U0010.Multiple = true;
      MT609.U0011 = new SwiftTagDefinition("FurtherIdentification_23", "Further Identification");
      MT609.U0011.TagName = ":23:";
      MT609.U0012 = new SwiftTagSubItemDefinition("FurtherIdentification", "Further Identification");
      MT609.U0011.Elements.Add((SwiftDefinitionElement) MT609.U0012);
      MT609.U0010.Elements.Add((SwiftDefinitionElement) MT609.U0011);
      MT609.U0013 = new SwiftTagSequenceDefinition("TransactionDetails_Sequence", "");
      MT609.U0013.Multiple = true;
      MT609.U0014 = new SwiftTagDefinition("IdentificationOfTheMetal_26C", "Identification of the Commodity");
      MT609.U0014.TagName = ":26C:";
      MT609.U0015 = new SwiftTagSubItemDefinition("IdentificationOfTheMetal", "Identification of the Commodity");
      MT609.U0014.Elements.Add((SwiftDefinitionElement) MT609.U0015);
      MT609.U0013.Elements.Add((SwiftDefinitionElement) MT609.U0014);
      MT609.U0016 = new SwiftTagChoiceDefinition("Choice", "");
      MT609.U0016.Multiple = true;
      MT609.U0017 = new SwiftTagDefinition("TransactionDetails_68B", "Transaction Details");
      MT609.U0017.TagName = ":68B:";
      MT609.U0017.Mandatory = false;
      MT609.U0017.Multiple = true;
      MT609.U0018 = new SwiftTagSubItemDefinition("Line1", "Line 1 of Subfield");
      MT609.U0019 = new SwiftTagSubItemDefinition("Part1", "Part 1 of Line 1");
      MT609.U001A = new SwiftTagSubItemDefinition("TradeDate", "Trade Date");
      MT609.U0019.Elements.Add((SwiftDefinitionElement) MT609.U001A);
      MT609.U001B = new SwiftTagSubItemDefinition("MaturityDate", "Maturity Date");
      MT609.U0019.Elements.Add((SwiftDefinitionElement) MT609.U001B);
      MT609.U001C = new SwiftTagSubItemDefinition("ContractNumber", "Contract Number");
      MT609.U0019.Elements.Add((SwiftDefinitionElement) MT609.U001C);
      MT609.U0018.Elements.Add((SwiftDefinitionElement) MT609.U0019);
      MT609.U001D = new SwiftTagSubItemDefinition("Part2", "Part 2 of Line 1");
      MT609.U001E = new SwiftTagSubItemDefinition("Indicator", "Indicator");
      MT609.U001D.Elements.Add((SwiftDefinitionElement) MT609.U001E);
      MT609.U001F = new SwiftTagSubItemDefinition("UnitandAmount", "Unit and Quantity of Commodity");
      MT609.U007F = new SwiftTagSubItemDefinition("Unit", "Unit");
      MT609.U001F.Elements.Add((SwiftDefinitionElement) MT609.U007F);
      MT609.U0080 = new SwiftTagSubItemDefinition("Quantity", "Quantity");
      MT609.U001F.Elements.Add((SwiftDefinitionElement) MT609.U0080);
      MT609.U001D.Elements.Add((SwiftDefinitionElement) MT609.U001F);
      MT609.U0018.Elements.Add((SwiftDefinitionElement) MT609.U001D);
      MT609.U0017.Elements.Add((SwiftDefinitionElement) MT609.U0018);
      MT609.U0081 = new SwiftTagSubItemDefinition("Line2", "Line 2 of Subfield");
      MT609.U0082 = new SwiftTagSubItemDefinition("CurrencyAndPrice", "Currency and Price Per Unit as Part 1 of Line 2");
      MT609.U0083 = new SwiftTagSubItemDefinition("CurrencyCode", "Currency Code");
      MT609.U0082.Elements.Add((SwiftDefinitionElement) MT609.U0083);
      MT609.U0084 = new SwiftTagSubItemDefinition("Price", "Price");
      MT609.U0082.Elements.Add((SwiftDefinitionElement) MT609.U0084);
      MT609.U0081.Elements.Add((SwiftDefinitionElement) MT609.U0082);
      MT609.U0086 = new SwiftTagSubItemDefinition("Part2", "Part 2 of Line 2");
      MT609.U0087 = new SwiftTagSubItemDefinition("ValueDate", "Value Date of the Consideration");
      MT609.U0086.Elements.Add((SwiftDefinitionElement) MT609.U0087);
      MT609.U0088 = new SwiftTagSubItemDefinition("CurrencyAndConsideration", "Currency and Consideration");
      MT609.U0089 = new SwiftTagSubItemDefinition("CurrencyCode", "Currency Code");
      MT609.U0088.Elements.Add((SwiftDefinitionElement) MT609.U0089);
      MT609.U008A = new SwiftTagSubItemDefinition("Price", "Price");
      MT609.U0088.Elements.Add((SwiftDefinitionElement) MT609.U008A);
      MT609.U0086.Elements.Add((SwiftDefinitionElement) MT609.U0088);
      MT609.U0081.Elements.Add((SwiftDefinitionElement) MT609.U0086);
      MT609.U0017.Elements.Add((SwiftDefinitionElement) MT609.U0081);
      MT609.U0016.Elements.Add((SwiftDefinitionElement) MT609.U0017);
      MT609.U008B = new SwiftTagDefinition("TransactionDetails_68C", "Transaction Details");
      MT609.U008B.TagName = ":68C:";
      MT609.U008B.Mandatory = false;
      MT609.U008B.Multiple = true;
      MT609.U008C = new SwiftTagSubItemDefinition("Line1", "Line 1 of Subfield");
      MT609.U008D = new SwiftTagSubItemDefinition("BuySellIndicator", "Buy/Sell Indicator");
      MT609.U008C.Elements.Add((SwiftDefinitionElement) MT609.U008D);
      MT609.U008E = new SwiftTagSubItemDefinition("CallPutIndicator", "Call/Put indicator");
      MT609.U008C.Elements.Add((SwiftDefinitionElement) MT609.U008E);
      MT609.U008F = new SwiftTagSubItemDefinition("Part3", "Part 3 of Line 1");
      MT609.U0090 = new SwiftTagSubItemDefinition("StyleIndicator", "Indicator");
      MT609.U008F.Elements.Add((SwiftDefinitionElement) MT609.U0090);
      MT609.U0091 = new SwiftTagSubItemDefinition("ContractDate", "Date Contract Agreed");
      MT609.U008F.Elements.Add((SwiftDefinitionElement) MT609.U0091);
      MT609.U0092 = new SwiftTagSubItemDefinition("UnitandAmount", "Unit and Amount of the Commodity ");
      MT609.U0093 = new SwiftTagSubItemDefinition("Unit", "Unit");
      MT609.U0092.Elements.Add((SwiftDefinitionElement) MT609.U0093);
      MT609.U0094 = new SwiftTagSubItemDefinition("Amount", "Quantity");
      MT609.U0092.Elements.Add((SwiftDefinitionElement) MT609.U0094);
      MT609.U008F.Elements.Add((SwiftDefinitionElement) MT609.U0092);
      MT609.U008C.Elements.Add((SwiftDefinitionElement) MT609.U008F);
      MT609.U008B.Elements.Add((SwiftDefinitionElement) MT609.U008C);
      MT609.U0095 = new SwiftTagSubItemDefinition("Line2", "Transaction Details");
      MT609.U0095.Mandatory = false;
      MT609.U008B.Elements.Add((SwiftDefinitionElement) MT609.U0095);
      MT609.U0016.Elements.Add((SwiftDefinitionElement) MT609.U008B);
      MT609.U0013.Elements.Add((SwiftDefinitionElement) MT609.U0016);
      MT609.U0010.Elements.Add((SwiftDefinitionElement) MT609.U0013);
      MT609.U0096 = new SwiftTagDefinition("SenderToReceiverInformation_72", "Sender to Receiver Information");
      MT609.U0096.TagName = ":72:";
      MT609.U0096.Mandatory = false;
      MT609.U0010.Elements.Add((SwiftDefinitionElement) MT609.U0096);
      MT609.MessageDefinition.Elements.Add((SwiftDefinitionElement) MT609.U0010);
    }

    public class BlockForNetworkRuleC85AndC86Class : SwiftTagSequence
    {
      internal override SwiftDefinitionElement Definition
      {
        get
        {
          return (SwiftDefinitionElement) MT609.U0010;
        }
      }

      [Description("Further Identification")]
      public MT609.BlockForNetworkRuleC85AndC86Class.Tag23 FurtherIdentification_23
      {
        get
        {
          return new MT609.BlockForNetworkRuleC85AndC86Class.Tag23((SwiftElement) this, 0, (SwiftDefinitionElement) MT609.U0011);
        }
      }

      [Description("Further Identification")]
      public MT609.BlockForNetworkRuleC85AndC86Class.Tag23 Tag23_FurtherIdentification
      {
        get
        {
          return this.FurtherIdentification_23;
        }
      }

      [Description("")]
      public MT609.BlockForNetworkRuleC85AndC86Class.TransactionDetails_SequenceClass[] TransactionDetails_Sequence
      {
        get
        {
          int index = -1;
          List<MT609.BlockForNetworkRuleC85AndC86Class.TransactionDetails_SequenceClass> list = new List<MT609.BlockForNetworkRuleC85AndC86Class.TransactionDetails_SequenceClass>();
          int count;
          do
          {
            ++index;
            MT609.BlockForNetworkRuleC85AndC86Class.TransactionDetails_SequenceClass detailsSequenceClass = new MT609.BlockForNetworkRuleC85AndC86Class.TransactionDetails_SequenceClass((SwiftElement) this, index, false);
            count = this.ListTags((SwiftElement) detailsSequenceClass).Count;
            if (count > 0)
              list.Add(detailsSequenceClass);
          }
          while (count > 0);
          return list.ToArray();
        }
      }

      [Description("Sender to Receiver Information")]
      public Tag72 SenderToReceiverInformation_72
      {
        get
        {
          return new Tag72((SwiftElement) this, 0, (SwiftDefinitionElement) MT609.U0096);
        }
      }

      [Description("Sender to Receiver Information")]
      public Tag72 Tag72_SenderToReceiverInformation
      {
        get
        {
          return this.SenderToReceiverInformation_72;
        }
      }

      internal BlockForNetworkRuleC85AndC86Class(SwiftElement parent, int index, bool createTags)
        : base(parent, index, createTags)
      {
      }

      public MT609.BlockForNetworkRuleC85AndC86Class.TransactionDetails_SequenceClass AddTransactionDetails_Sequence()
      {
        return new MT609.BlockForNetworkRuleC85AndC86Class.TransactionDetails_SequenceClass((SwiftElement) this, this.TransactionDetails_Sequence.Length, true);
      }

      public void RemoveTransactionDetails_Sequence(MT609.BlockForNetworkRuleC85AndC86Class.TransactionDetails_SequenceClass sequence)
      {
        foreach (SwiftTag tag in this.ListTags((SwiftElement) sequence))
          this.RemoveTag(tag);
      }

      public class Tag23 : SwiftTagWrapper
      {
        public string Value
        {
          get
          {
            return this.GetValue();
          }
          set
          {
            this.SetValue("23", value);
          }
        }

        internal Tag23(SwiftElement parent, int index, SwiftDefinitionElement definition)
          : base(parent, index, definition)
        {
        }
      }

      public class TransactionDetails_SequenceClass : SwiftTagSequence
      {
        internal override SwiftDefinitionElement Definition
        {
          get
          {
            return (SwiftDefinitionElement) MT609.U0013;
          }
        }

        [Description("Identification of the Commodity")]
        public Tag26C IdentificationOfTheMetal_26C
        {
          get
          {
            return new Tag26C((SwiftElement) this, 0, (SwiftDefinitionElement) MT609.U0014);
          }
        }

        [Description("Identification of the Commodity")]
        public Tag26C Tag26C_IdentificationOfTheMetal
        {
          get
          {
            return this.IdentificationOfTheMetal_26C;
          }
        }

        [Description("Transaction Details")]
        public Tag68B[] TransactionDetails_68B
        {
          get
          {
            int index = -1;
            List<Tag68B> list = new List<Tag68B>();
            int count;
            do
            {
              ++index;
              Tag68B tag68B = new Tag68B((SwiftElement) this, index, (SwiftDefinitionElement) MT609.U0017);
              count = this.ListTags((SwiftElement) tag68B).Count;
              if (count > 0)
                list.Add(tag68B);
            }
            while (count > 0);
            return list.ToArray();
          }
        }

        [Description("Transaction Details")]
        public Tag68B[] Tag68B_TransactionDetails
        {
          get
          {
            return this.TransactionDetails_68B;
          }
        }

        [Description("Transaction Details")]
        public Tag68C[] TransactionDetails_68C
        {
          get
          {
            int index = -1;
            List<Tag68C> list = new List<Tag68C>();
            int count;
            do
            {
              ++index;
              Tag68C tag68C = new Tag68C((SwiftElement) this, index, (SwiftDefinitionElement) MT609.U008B);
              count = this.ListTags((SwiftElement) tag68C).Count;
              if (count > 0)
                list.Add(tag68C);
            }
            while (count > 0);
            return list.ToArray();
          }
        }

        [Description("Transaction Details")]
        public Tag68C[] Tag68C_TransactionDetails
        {
          get
          {
            return this.TransactionDetails_68C;
          }
        }

        internal TransactionDetails_SequenceClass(SwiftElement parent, int index, bool createTags)
          : base(parent, index, createTags)
        {
        }

        public Tag68B AddTransactionDetails_68B()
        {
          return new Tag68B((SwiftElement) this, this.TransactionDetails_68B.Length, (SwiftDefinitionElement) MT609.U0017)
          {
            Value = string.Empty
          };
        }

        public void RemoveTransactionDetails_68B(Tag68B tag)
        {
          this.RemoveTag(tag.GetTag());
        }

        public Tag68C AddTransactionDetails_68C()
        {
          return new Tag68C((SwiftElement) this, this.TransactionDetails_68C.Length, (SwiftDefinitionElement) MT609.U008B)
          {
            Value = string.Empty
          };
        }

        public void RemoveTransactionDetails_68C(Tag68C tag)
        {
          this.RemoveTag(tag.GetTag());
        }
      }
    }
  }
}
